class SpiderErrorToEnd(Exception):
    ...


class SpiderErrorToRetry(Exception):
    ...


class APIException(Exception):
    def __init__(self, msg: str, state=99):
        self.state = state
        self.msg = msg

    def __str__(self):
        return self.msg


class ItemNotFoundException(APIException):

    def __init__(self, collection_name: str):
        super(ItemNotFoundException, self).__init__(f"{collection_name} 表没有匹配到数据", 88)


class ItemAlreadyExitsException(APIException):

    def __init__(self, msg):
        super(ItemAlreadyExitsException, self).__init__(msg, 89)
